package com.pinganfu.mock.server;

import java.io.OutputStream;  
import java.net.Socket;  
  
public class Client2 {  
    static class SendThread extends Thread {  
        Socket server;  
        byte[] value;  
  
        public SendThread(Socket server, String value) {  
            super();  
            this.server = server;  
            this.value = value.getBytes();  
        }  
  
        public void run() {  
            while (true) {  
                try {  
                    OutputStream out = server.getOutputStream();  
                    out.write(value);
                    out.write(33333);
                    out.flush();  
                    Thread.sleep(3000);  
                } catch (Exception ex) {  
                    return;  
                }  
            }  
        }  
    }  
  
    /** 
     * @param args 
     */  
    public static void main(String[] args) throws Exception {  
        Socket server = new Socket("localhost", 9090);  
        SendThread t1 = new SendThread(server, "2222");  
        t1.start();  
    }  
  
    
    
}  
